<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>登陆页面</title>

    <link rel="stylesheet" type="text/css" href="css/style.css">

    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/vector.js"></script>

</head>
<body>

<div id="container">
    <div id="output">
        <div class="containerT">
            <h1>用户登录</h1>
            <form class="form" id="entry_form">
                <input type="text" placeholder="用户名" id="entry_name" value="admin">
                <input type="password" placeholder="密码" id="entry_password">
                <button type="button" id="entry_btn">登录</button>
                <div id="prompt" class="prompt"></div>
            </form>
        </div>
    </div>
</div>

<script type="text/javascript">
    $(function(){
        Victor("container", "output");   //登录背景函数
    });
    $("#entry_btn").click(function(){
        var username = $("#entry_name").val();
        var password = $("#entry_password").val();
        $.ajax({
            type:"post",//请求方式post get
            url:"login.do",//请求地址
            data:{//前端传给后台的参数
                username:username,
                password:password
            },
            dataType:"json",//交互的数据的格式
            success:function(result){//后台响应成功，result后台传给前台的参数
                if(result.status == true){//如果返回状态为true,代表登录成功
                    if(username == "admin"){
                        location.href = "pages/manager/index.jsp";
                    }else{
                        location.href = "pages/video/videoIndex.jsp";
                    }
                }else{//登录失败
                    alert(result.message);
                }
            }
        });
    });
</script>
</body>
</html>
